
#ifndef _DynLib_H__
#define _DynLib_H__

 
/*#if PLATFORM == PLATFORM_WIN32*/
#    define DYNLIB_HANDLE hInstance
#    define DYNLIB_LOAD( a ) LoadLibraryEx( a, NULL, LOAD_WITH_ALTERED_SEARCH_PATH )
#    define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
#    define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
/*#endif*/
 
struct HINSTANCE__;
typedef struct HINSTANCE__* hInstance;


namespace Apo
{


 
	class   DynLib  
    {
	protected:
		String mName;
        /// Gets the last loading error
        String dynlibError(void);
    public:
        /** Default constructor - used by DynLibManager.
            @warning
                Do not call directly
        */
        DynLib( const String& name );
        ~DynLib();

        /** Load the library
        */
        void load();
        /** Unload the library
        */
        void unload();
		/// Get the name of the library
		const String& getName(void) const { return mName; }

 
        void* getSymbol( const String& strName ) const throw();

    protected:

        /// Handle to the loaded library.
        DYNLIB_HANDLE m_hInst;
    };
	 
}
 

#endif
